﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace Assist
{
	[Transaction(TransactionMode.Manual)]
	[Regeneration(RegenerationOption.Manual)]
	public class CmdCoypElement : YJKCommandAuto
	{
		protected override Result YJKExcute(ExternalCommandData cmdData, ref string message, ElementSet elements)
		{
			IList<Reference> list = cmdData.Application.ActiveUIDocument.Selection.PickObjects(Autodesk.Revit.UI.Selection.ObjectType.Element, "选择要复制的对象");
			XYZ xyz = cmdData.Application.ActiveUIDocument.Selection.PickPoint("选择移动起点");
			XYZ xyz2 = cmdData.Application.ActiveUIDocument.Selection.PickPoint("选择移动终点");
			XYZ xyz3 = xyz2 - xyz;
			List<ElementId> list2 = new List<ElementId>();
			foreach (Reference reference in list)
			{
				list2.Add(reference.ElementId);
			}
			ElementTransformUtils.CopyElements(this.m_doc, list2, xyz3);
			return Autodesk.Revit.UI.Result.Succeeded;
		}
	}
}
